{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 逻辑回归-线性不可分案例\n",
    "## 案例：设想你是工厂的生产主管，你要决定是否芯片要被接受或抛弃\n",
    "## 数据集：ex2data2.txt,芯片在两次测试中的测试结果"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Test 1</th>\n",
       "      <th>Test 2</th>\n",
       "      <th>Accepted</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.051267</td>\n",
       "      <td>0.69956</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-0.092742</td>\n",
       "      <td>0.68494</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-0.213710</td>\n",
       "      <td>0.69225</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-0.375000</td>\n",
       "      <td>0.50219</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>-0.513250</td>\n",
       "      <td>0.46564</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     Test 1   Test 2  Accepted\n",
       "0  0.051267  0.69956         1\n",
       "1 -0.092742  0.68494         1\n",
       "2 -0.213710  0.69225         1\n",
       "3 -0.375000  0.50219         1\n",
       "4 -0.513250  0.46564         1"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "path = 'ex2data2.txt'\n",
    "data = pd.read_csv(path, names=['Test 1', 'Test 2', 'Accepted'])\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZQAAAEKCAYAAAA1qaOTAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJztnXu0HWWV4H87bzOieYKRcO8NEhxiK0Ez4GPRDY0PdDEE7cjD2B0krIitco3jNGGlIbfpzhqwexnDwAymEYMmEASXmlFZDIhOL2eIeGnCI2FCQoB4IcIlEMVJJ5DcPX9UHVLn5DzqnPNV1VdV+7dWrXuq6quqferWqf3tx7c/UVUMwzAMo1tGZS2AYRiGUQxMoRiGYRhOMIViGIZhOMEUimEYhuEEUyiGYRiGE0yhGIZhGE4whWIYhmE4wRSKYRiG4QRTKIZhGIYTxmQtQJpMmzZN+/r6shbDMAwjVzz00EMvqer0Vu1KpVD6+voYHBzMWgzDMIxcISLPxmlnLi/DMAzDCaZQDMMwDCeYQjEMwzCcUKoYimEYRje8/vrrDA0NsX///qxFSYQJEyYwc+ZMxo4d29HxplAMwzBiMjQ0xFFHHUVfXx8ikrU4TlFV9uzZw9DQELNmzeroHObyMgzDiMn+/fuZOnVq4ZQJgIgwderUrqwvUyhGuamdsdRmMDVaUERlUqHb72YKxSgvAwOwdOlhJaIarA8MZCmVYeQWUyhGOVGFvXth9erDSmXp0mB9795iWipmjZWWp59+mtNOO43Zs2dzwQUX8NprryVyHVMoRjkRgVWroL8/UCKjRgV/+/uD7UVza5g1lg2eKPErrriCpUuXsn37diZPnsy3v/3tRK5jCsUoLxWlEqWIyqSM1pgPJKDEr7rqKlavXv3G+vLly7n++uubHqOq3H///SxYsACARYsW8aMf/ahjGZphacNGean8wKMsXVo8pRJVnKtXBwsU1xrzgagSh+A+V5R4f3+wv4P7vnjxYj71qU/R39/PyMgIGzZs4P7772fu3Ll12992220cffTRTJo0iTFjgtf9zJkzee655zr+as0whWKUk2gvvfJiraxD8V60FaUS6d0W7jv6REJKvK+vj6lTp/Lwww/zwgsvcMopp9Db28vmzZsbHjM8PFxHvGT+76ZQjHIiApMmVf/AKy+ASZOK96ItizXmEwkp8UsvvZS1a9fyu9/9jksuuYRXX32V008/vW7b2267jZNOOom9e/dy8OBBxowZw9DQEG9/+9u7kqEhqlqa5X3ve58aRhUjI83Xi8DIiGp/vyoEf+utG7HYunVr/MbR+1xZHNzvAwcO6IknnqizZs3SgwcPxjpmwYIFevvtt6uq6uc//3m98cYbG7at9x2BQY3xjrWgvFFuanuLReytN7LG+vuLaY35QK1LdWTkcEZhNFDfAePGjePMM8/k/PPPZ/To0bGOue666/jGN77BCSecwJ49e1i8eHHH12+GubwMowwMDFQHgitKxZRJMiToUh0ZGWHTpk3ceeedsY85/vjjefDBBzu+ZlwytVBE5BYReVFEHm+wX0TkehHZISKPish7I/sWicj2cFmUntQFw5M8+dyQ5/tVBmvMJwYGqpV2Ral0kTa8detWTjjhBM466yxmz57tREyXZG2hrAVuAL7bYP/Hgdnhchrw34HTRGQKsAKYByjwkIhsVNVXEpe4SAwMBKmNlYe+YqZPmlTsAW+1KZtxUzjLer+MznGsxOfMmcPOnTu7OkeSZGqhqOq/AC83aTIf+G4YF9oETBK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/Y4eyxZVvRmT1XOCJ8PM9wEdDOScDH6Xakk9FvlDGdxIEtx+IbEvj/rViI/BXYbbX+4Hfh52qNO5da9LOAijiQuA7/zmwPfw7Jdw+D7g50q4PeA4YVXP8/cBjBC/DdcCb05YP+GAowyPh38WR448neCnuAO4Exqcs22eB14HNkWVukveOIJvmSYLe5/Jw2zUEL2mACeG92BHem+Mjxy4Pj9sGfDyB562VbPcBL0Tu1cZW/+OU5fsvwJZQjl8A/z5y7CXhPd0BfC4L+cL1AeDamuMSv38Enc3d4fM+RBADuwy4LNwvwI2h7I8B89K8d60WGylvGIZhOMFcXoZhGIYTTKEYhmEYTjCFYhiGYTjBFIphGIbhBFMohmEYhhNMoRiGQ0RkaqQa7e9E5LnIeuwqzSJyiYi8LbLeLyJPiYiKyKRkpDeM7rC0YcNICBEZIKhO+08dHPsr4EuqujlcP4VgJP7/Bv5EVfc2O94wssBKrxhGSoRzVHyRoO7Y/wG+ROAl+A4wl2DQ2hqCQYlzgTtE5N+AU1X14fAcGUhuGPEwhWIYKSAifwJ8Evigqh4UkTUEZT+eAqap6rvDdpNUda+IfJmIhWIYecAUimGkw4eB/wAMhlbGmwjKjd8DvFNEVgM/A/5nZhIaRpeYQjGMdBCCmf+uOmKHyHuAjwOXA38BLElZNsNwgmV5GUY63AecH1aprWSD9YjIdILkmDuBFQTTvwK8ChyVjaiG0RlmoRhGCqjqYyLyd8B9IjKKoJrsZcAh4Nth+X0lmCAMgkD9zZWgPEEA/6sEE5VtEZGfqOrn0/4ehtEMSxs2DMMwnGAuL8MwDMMJplAMwzAMJ5hCMQzDMJxgCsUwDMNwgikUwzAMwwmmUAzDMAwnmEIxDMMwnGAKxTAMw3DC/wdP2QOrk8t2OQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig,ax = plt.subplots()\n",
    "ax.scatter(data[data['Accepted']==0]['Test 1'],data[data['Accepted']==0]['Test 2'],c='r',marker='x',label='y=0')\n",
    "ax.scatter(data[data['Accepted']==1]['Test 1'],data[data['Accepted']==1]['Test 2'],c='b',marker='o',label='y=1')\n",
    "ax.legend()\n",
    "ax.set(xlabel='Test1',\n",
    "          ylabel='Test2')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 特征映射"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "def feature_mapping(x1,x2,power):\n",
    "    data = {}\n",
    "    \n",
    "    for i in np.arange(power+1):\n",
    "        for j in np.arange(i + 1):\n",
    "            data['F{}{}'.format(i-j,j)] = np.power(x1,i-j) * np.power(x2,j)\n",
    "            \n",
    "    return pd.DataFrame(data) \n",
    "                 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "x1 = data['Test 1']\n",
    "x2 = data['Test 2']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "data2 = feature_mapping(x1,x2,6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>F00</th>\n",
       "      <th>F10</th>\n",
       "      <th>F01</th>\n",
       "      <th>F20</th>\n",
       "      <th>F11</th>\n",
       "      <th>F02</th>\n",
       "      <th>F30</th>\n",
       "      <th>F21</th>\n",
       "      <th>F12</th>\n",
       "      <th>F03</th>\n",
       "      <th>...</th>\n",
       "      <th>F23</th>\n",
       "      <th>F14</th>\n",
       "      <th>F05</th>\n",
       "      <th>F60</th>\n",
       "      <th>F51</th>\n",
       "      <th>F42</th>\n",
       "      <th>F33</th>\n",
       "      <th>F24</th>\n",
       "      <th>F15</th>\n",
       "      <th>F06</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.0</td>\n",
       "      <td>0.051267</td>\n",
       "      <td>0.69956</td>\n",
       "      <td>0.002628</td>\n",
       "      <td>0.035864</td>\n",
       "      <td>0.489384</td>\n",
       "      <td>0.000135</td>\n",
       "      <td>0.001839</td>\n",
       "      <td>0.025089</td>\n",
       "      <td>0.342354</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000900</td>\n",
       "      <td>0.012278</td>\n",
       "      <td>0.167542</td>\n",
       "      <td>1.815630e-08</td>\n",
       "      <td>2.477505e-07</td>\n",
       "      <td>0.000003</td>\n",
       "      <td>0.000046</td>\n",
       "      <td>0.000629</td>\n",
       "      <td>0.008589</td>\n",
       "      <td>0.117206</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1.0</td>\n",
       "      <td>-0.092742</td>\n",
       "      <td>0.68494</td>\n",
       "      <td>0.008601</td>\n",
       "      <td>-0.063523</td>\n",
       "      <td>0.469143</td>\n",
       "      <td>-0.000798</td>\n",
       "      <td>0.005891</td>\n",
       "      <td>-0.043509</td>\n",
       "      <td>0.321335</td>\n",
       "      <td>...</td>\n",
       "      <td>0.002764</td>\n",
       "      <td>-0.020412</td>\n",
       "      <td>0.150752</td>\n",
       "      <td>6.362953e-07</td>\n",
       "      <td>-4.699318e-06</td>\n",
       "      <td>0.000035</td>\n",
       "      <td>-0.000256</td>\n",
       "      <td>0.001893</td>\n",
       "      <td>-0.013981</td>\n",
       "      <td>0.103256</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1.0</td>\n",
       "      <td>-0.213710</td>\n",
       "      <td>0.69225</td>\n",
       "      <td>0.045672</td>\n",
       "      <td>-0.147941</td>\n",
       "      <td>0.479210</td>\n",
       "      <td>-0.009761</td>\n",
       "      <td>0.031616</td>\n",
       "      <td>-0.102412</td>\n",
       "      <td>0.331733</td>\n",
       "      <td>...</td>\n",
       "      <td>0.015151</td>\n",
       "      <td>-0.049077</td>\n",
       "      <td>0.158970</td>\n",
       "      <td>9.526844e-05</td>\n",
       "      <td>-3.085938e-04</td>\n",
       "      <td>0.001000</td>\n",
       "      <td>-0.003238</td>\n",
       "      <td>0.010488</td>\n",
       "      <td>-0.033973</td>\n",
       "      <td>0.110047</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1.0</td>\n",
       "      <td>-0.375000</td>\n",
       "      <td>0.50219</td>\n",
       "      <td>0.140625</td>\n",
       "      <td>-0.188321</td>\n",
       "      <td>0.252195</td>\n",
       "      <td>-0.052734</td>\n",
       "      <td>0.070620</td>\n",
       "      <td>-0.094573</td>\n",
       "      <td>0.126650</td>\n",
       "      <td>...</td>\n",
       "      <td>0.017810</td>\n",
       "      <td>-0.023851</td>\n",
       "      <td>0.031940</td>\n",
       "      <td>2.780914e-03</td>\n",
       "      <td>-3.724126e-03</td>\n",
       "      <td>0.004987</td>\n",
       "      <td>-0.006679</td>\n",
       "      <td>0.008944</td>\n",
       "      <td>-0.011978</td>\n",
       "      <td>0.016040</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1.0</td>\n",
       "      <td>-0.513250</td>\n",
       "      <td>0.46564</td>\n",
       "      <td>0.263426</td>\n",
       "      <td>-0.238990</td>\n",
       "      <td>0.216821</td>\n",
       "      <td>-0.135203</td>\n",
       "      <td>0.122661</td>\n",
       "      <td>-0.111283</td>\n",
       "      <td>0.100960</td>\n",
       "      <td>...</td>\n",
       "      <td>0.026596</td>\n",
       "      <td>-0.024128</td>\n",
       "      <td>0.021890</td>\n",
       "      <td>1.827990e-02</td>\n",
       "      <td>-1.658422e-02</td>\n",
       "      <td>0.015046</td>\n",
       "      <td>-0.013650</td>\n",
       "      <td>0.012384</td>\n",
       "      <td>-0.011235</td>\n",
       "      <td>0.010193</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 28 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   F00       F10      F01       F20       F11       F02       F30       F21  \\\n",
       "0  1.0  0.051267  0.69956  0.002628  0.035864  0.489384  0.000135  0.001839   \n",
       "1  1.0 -0.092742  0.68494  0.008601 -0.063523  0.469143 -0.000798  0.005891   \n",
       "2  1.0 -0.213710  0.69225  0.045672 -0.147941  0.479210 -0.009761  0.031616   \n",
       "3  1.0 -0.375000  0.50219  0.140625 -0.188321  0.252195 -0.052734  0.070620   \n",
       "4  1.0 -0.513250  0.46564  0.263426 -0.238990  0.216821 -0.135203  0.122661   \n",
       "\n",
       "        F12       F03    ...          F23       F14       F05           F60  \\\n",
       "0  0.025089  0.342354    ...     0.000900  0.012278  0.167542  1.815630e-08   \n",
       "1 -0.043509  0.321335    ...     0.002764 -0.020412  0.150752  6.362953e-07   \n",
       "2 -0.102412  0.331733    ...     0.015151 -0.049077  0.158970  9.526844e-05   \n",
       "3 -0.094573  0.126650    ...     0.017810 -0.023851  0.031940  2.780914e-03   \n",
       "4 -0.111283  0.100960    ...     0.026596 -0.024128  0.021890  1.827990e-02   \n",
       "\n",
       "            F51       F42       F33       F24       F15       F06  \n",
       "0  2.477505e-07  0.000003  0.000046  0.000629  0.008589  0.117206  \n",
       "1 -4.699318e-06  0.000035 -0.000256  0.001893 -0.013981  0.103256  \n",
       "2 -3.085938e-04  0.001000 -0.003238  0.010488 -0.033973  0.110047  \n",
       "3 -3.724126e-03  0.004987 -0.006679  0.008944 -0.011978  0.016040  \n",
       "4 -1.658422e-02  0.015046 -0.013650  0.012384 -0.011235  0.010193  \n",
       "\n",
       "[5 rows x 28 columns]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data2.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 构造数据集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = data2.values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(118, 28)"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "y = data.iloc[:,-1].values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(118, 1)"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y = y.reshape(len(y),1)\n",
    "y.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 损失函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "def sigmoid(z):\n",
    "    return 1/(1+np.exp(-z))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "def costFunction(X,y,theta,lamda):\n",
    "    A = sigmoid(X@theta)\n",
    "    \n",
    "    first = y*np.log(A)\n",
    "    second = (1-y) * np.log(1-A)\n",
    "    \n",
    "    reg = np.sum(np.power(theta[1:],2)) * (lamda / (2 * len(X)))\n",
    "    \n",
    "    return -np.sum(first + second ) / len(X) + reg"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(28, 1)"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "theta = np.zeros((28,1))\n",
    "theta.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "lamda = 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.6931471805599454\n"
     ]
    }
   ],
   "source": [
    "cost_init = costFunction(X,y,theta,lamda)\n",
    "print(cost_init)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 梯度下降函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "def gradientDescent(X,y,theta,alpha,iters,lamda):\n",
    "    \n",
    "    costs = []\n",
    "    \n",
    "    for i in range(iters):\n",
    "        \n",
    "        reg = theta[1:] * (lamda / len(X))\n",
    "        reg = np.insert(reg,0,values=0,axis=0)\n",
    "        \n",
    "        theta = theta - (X.T@(sigmoid(X@theta) - y)) * alpha / len(X) -reg\n",
    "        cost = costFunction(X,y,theta,lamda)\n",
    "        costs.append(cost)\n",
    "        \n",
    "        if i % 1000 == 0:\n",
    "            print(cost)\n",
    "            \n",
    "    return theta,costs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [],
   "source": [
    "alpha = 0.001\n",
    "iters = 200000\n",
    "# lamda = 0.001\n",
    "lamda = 0.1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.6931343808043247\n",
      "0.6853092313769457\n",
      "0.682468657526718\n",
      "0.6813587324505798\n",
      "0.6808978476737331\n",
      "0.6806913350632312\n",
      "0.6805888353170843\n",
      "0.6805314383931685\n",
      "0.6804953370228699\n",
      "0.6804704613430752\n",
      "0.6804522468511385\n",
      "0.6804384159056968\n",
      "0.6804276951503886\n",
      "0.6804192894736895\n",
      "0.6804126563796228\n",
      "0.68040740251216\n",
      "0.6804032316923775\n",
      "0.6803999159055469\n",
      "0.6803972773350363\n",
      "0.6803951762525547\n",
      "0.680393502349229\n",
      "0.680392168283467\n",
      "0.6803911047619559\n",
      "0.6803902567339369\n",
      "0.6803895804197043\n",
      "0.6803890409766992\n",
      "0.6803886106590799\n",
      "0.6803882673623591\n",
      "0.6803879934702022\n",
      "0.6803877749392417\n",
      "0.6803876005719449\n",
      "0.6803874614383533\n",
      "0.6803873504158933\n",
      "0.6803872618229403\n",
      "0.680387191126901\n",
      "0.6803871347115849\n",
      "0.6803870896917618\n",
      "0.6803870537653038\n",
      "0.6803870250952787\n",
      "0.680387002215901\n",
      "0.680386983957519\n",
      "0.6803869693867678\n",
      "0.6803869577588266\n",
      "0.6803869484793237\n",
      "0.6803869410739429\n",
      "0.6803869351641717\n",
      "0.6803869304479463\n",
      "0.680386926684214\n",
      "0.6803869236806058\n",
      "0.6803869212836058\n",
      "0.6803869193707021\n",
      "0.6803869178441269\n",
      "0.6803869166258568\n",
      "0.6803869156536272\n",
      "0.6803869148777473\n",
      "0.6803869142585629\n",
      "0.6803869137644276\n",
      "0.6803869133700875\n",
      "0.6803869130553876\n",
      "0.6803869128042435\n",
      "0.6803869126038202\n",
      "0.680386912443874\n",
      "0.6803869123162303\n",
      "0.6803869122143651\n",
      "0.6803869121330722\n",
      "0.6803869120681975\n",
      "0.6803869120164242\n",
      "0.6803869119751075\n",
      "0.6803869119421347\n",
      "0.6803869119158211\n",
      "0.6803869118948219\n",
      "0.6803869118780637\n",
      "0.6803869118646896\n",
      "0.6803869118540166\n",
      "0.6803869118454993\n",
      "0.680386911838702\n",
      "0.6803869118332776\n",
      "0.6803869118289484\n",
      "0.6803869118254938\n",
      "0.6803869118227367\n",
      "0.6803869118205366\n",
      "0.6803869118187805\n",
      "0.6803869118173794\n",
      "0.6803869118162609\n",
      "0.6803869118153686\n",
      "0.6803869118146565\n",
      "0.680386911814088\n",
      "0.6803869118136346\n",
      "0.6803869118132728\n",
      "0.6803869118129838\n",
      "0.6803869118127533\n",
      "0.680386911812569\n",
      "0.6803869118124225\n",
      "0.6803869118123053\n",
      "0.6803869118122117\n",
      "0.6803869118121371\n",
      "0.6803869118120778\n",
      "0.6803869118120298\n",
      "0.680386911811992\n",
      "0.6803869118119618\n",
      "0.6803869118119377\n",
      "0.6803869118119182\n",
      "0.6803869118119029\n",
      "0.6803869118118908\n",
      "0.6803869118118809\n",
      "0.6803869118118732\n",
      "0.6803869118118671\n",
      "0.6803869118118621\n",
      "0.680386911811858\n",
      "0.680386911811855\n",
      "0.6803869118118523\n",
      "0.6803869118118504\n",
      "0.6803869118118484\n",
      "0.6803869118118477\n",
      "0.6803869118118467\n",
      "0.6803869118118464\n",
      "0.6803869118118453\n",
      "0.680386911811845\n",
      "0.6803869118118446\n",
      "0.6803869118118449\n",
      "0.6803869118118437\n",
      "0.6803869118118434\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118434\n",
      "0.6803869118118435\n",
      "0.6803869118118435\n",
      "0.6803869118118435\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n",
      "0.6803869118118436\n"
     ]
    }
   ],
   "source": [
    "theta_final,costs = gradientDescent(X,y,theta,alpha,iters,lamda)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [],
   "source": [
    "def predict(X,theta):\n",
    "    \n",
    "    prob = sigmoid(X@theta)\n",
    "    \n",
    "    return [1 if x >= 0.5 else 0 for x in prob]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.6101694915254238\n"
     ]
    }
   ],
   "source": [
    "y_ = np.array(predict(X,theta_final))\n",
    "y_pre = y_.reshape(len(y_),1)\n",
    "\n",
    "acc  = np.mean(y_pre == y)\n",
    "\n",
    "print(acc)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAEKCAYAAADuEgmxAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJztnXl4U2X2x79v0x1KW1r20pZV2WRVGX/quNQFdEQ0CFgVEUQdl4qzuKBSHRnXEeuMo+KuFPcZdRwER1BRHEbLJhZQltJSSksLbSndm5zfHzeBJE2am+Suyfk8z32Se3Pzvufe3LznPee873kFEYFhGIZh5BCltwAMwzCMeWClwTAMw8iGlQbDMAwjG1YaDMMwjGxYaTAMwzCyYaXBMAzDyIaVBsMwDCMbVhoMwzCMbFhpMAzDMLKJ1lsApUlPT6fs7Gy9xWAYhjEVGzdurCGiXv7OCzulkZ2djaKiIr3FYBiGMRVCiFI557F7imEYhpENKw2GYRhGNqw0GIZhGNmEXUyDYTSDCBDC9z5jWtrb21FeXo6Wlha9RVGc+Ph4ZGRkICYmJqjvs9JgmGDIzwfq6oClSyVFQQQsXAikpEifMaamvLwcSUlJyM7OhgijjgAR4fDhwygvL8egQYOCKoPdUwwTKESSwigokBSFU2EUFEjHzbiwmafMZrwGBWlpaUFaWlpYKQwAEEIgLS0tJAuKLQ2GCRQhJAsDkBRFQYH0Pi/vhOVhJthq8kq4KQwnoV4XWxoMEwyuisOJGRVGOFpNjKqw0mCYYHA2rq44G10z4VR+eXmSooiKkl7NajVFOCUlJTj99NMxbNgwzJw5E21tbYrXwUqDYQLFtTeelwfY7ScaXTMrDldYYQSGQWJCd999NxYuXIhdu3YhNTUVr7zyiuJ1sNJgmEARQvL3u/bGnb31lBTzNbbhYjXpRX6++/1y3s8Q4kEPPPAACpyxMgCLFi3Cs88+2+V3iAhr166F1WoFAMyZMwcfffRR0DL4ggPhDBMM+fnu8zKcis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XPZjAyjnBiFEX5f9PCHEHiEECSFS1JGeYYKHh9wyTIgIIfIBHCOip4L47rcAbiOiLY798ZBmhq8HMJqI6pSUlWFChdOIMIzCCCHmALgVQCyA7wDcBsmqfw3AOEiTtZZBmhw6DsC7QohmAKcR0WZHGTpIzjD+YaXBMAoihBgNKWvAGUTUIYRYBillxh4A6UQ0xnFeChHVCSFuh4ulwTBGh5UGwyhLDoBTARQ5rIUESGmtVwM4SQhRAGAlgM91k5BhQoCVBsMoiwDwKhE90OkDIU6BtArbHQCuhLQKG8OYCh49xTDK8gWAqxxZfJ2jrDKFEL0gDTx5H8BiAM51nhsAJOkjKsMEDlsaDKMgRLRNCPEQgC+EEFGQMpfeDMAG4BXHkq4E4G7HV14D8LIzEA4paH4XpMWuioUQnxLRTVpfB8P4gofcMgzDMLJh9xTDMAwjG1YaDMMwjGxYaTAMwzCyYaXBMAzDyIaVBsMwDCMbVhoMwzCMbFhpMAzDMLJhpcEwDMPI5v8BR+WBm/j5DdMAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.linspace(-1.2,1.2,200)\n",
    "xx,yy = np.meshgrid(x,x)\n",
    "z = feature_mapping(xx.ravel(),yy.ravel(),6).values\n",
    "\n",
    "zz = z @ theta_final\n",
    "zz = zz.reshape(xx.shape)\n",
    "\n",
    "fig,ax = plt.subplots()\n",
    "ax.scatter(data[data['Accepted']==0]['Test 1'],data[data['Accepted']==0]['Test 2'],c='r',marker='x',label='y=0')\n",
    "ax.scatter(data[data['Accepted']==1]['Test 1'],data[data['Accepted']==1]['Test 2'],c='b',marker='o',label='y=1')\n",
    "ax.legend()\n",
    "ax.set(xlabel='Test1',\n",
    "          ylabel='Test2')\n",
    "\n",
    "plt.contour(xx,yy,zz,0)\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
